#define _CRT_SECURE_NO_WARNINGS 1

namespace zy
{
	template<class K>
	class set
	{
		struct SetKeyOfT
		{
			const K& operator()(const K& key)
			{
				return key;
			}
		};
	public:
		typedef typename RBTree<K, const K, SetKeyOfT>::Iterator iterator;
		typedef typename RBTree<K, const K, SetKeyOfT>::ConstIterator const_iterator;

		iterator begin()
		{
			return _t.Begin();
		}
		iterator end()
		{
			return _t.End();
		}
		const_iterator begin() const
		{
			return _t.Begin();
		}
		const_iterator end() const
		{
			return _t.End();
		}


		pair<iterator, bool> insert(const K& key)
		{
			return _t.Insert(key);
		}


	private:
		RBTree<K, const K, SetKeyOfT> _t;
	};

	void test_set()
	{
		set<int> s;
		s.insert(1);
		s.insert(6);
		s.insert(9);
		s.insert(2);
		s.insert(4);
		s.insert(7);

		set<int>::iterator it = s.begin();
		while (it != s.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;

		set<int>::iterator it1 = s.begin();
		while (it1 != s.end())
		{
			//*it1 += 2;
			cout << *it1 << " ";
			++it1;
		}
		cout << endl;
	}

	void test_set1()
	{
		set<int> s;
		s.insert(1);
		s.insert(6);
		s.insert(9);
		s.insert(2);
		s.insert(4);
		s.insert(7);
		const set<int> s1(s);

		set<int>::const_iterator it = s1.begin();
		while (it != s1.end())
		{
			cout << *it << " ";
			++it;
		}
		cout << endl;
	}
}